package com.fjec.common.jackson;

import com.fasterxml.jackson.databind.module.SimpleModule;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;

public class SimpleModuleRegistry extends SimpleModule {

    private static final long serialVersionUID = -7564876712691825182L;

    public SimpleModuleRegistry() {
        // Date
        addDeserializer(Date.class, new DateDeserializer());
        addSerializer(Date.class, new DateSerializer());
        // LocalDateTime
        addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer());
        addSerializer(LocalDateTime.class, new LocalDateTimeSerializer());
        // LocalDate
        addDeserializer(LocalDate.class, new LocalDateDeserializer());
        addSerializer(LocalDate.class, new LocalDateSerializer());
    }

}
